#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <string>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <cmath>
#include <iostream>

using namespace std;


int main() {
  int N;
  cin >> N;
  int arr[101111];
  int edge[101111][20];
  memset(edge, 0x3f, sizeof(edge));
  for (int i = 0 ; i < N; i ++) {
    cin >> arr[i];
  }
  for (int bit = 0; bit < 20; bit++) {
    int last = 1000000;
    for (int i = N-1; i>=0; --i) {
      if (arr[i] & (1<<bit)) last = i;
      edge[i][bit] = last;
    }
  }
  set<int> res;
  for (int i = 0; i < N; ++i) {
    int mask = arr[i];
    res.insert(mask);
    int pos = i;
    while (pos < N) {
      int next = 1000000;
      for (int bit = 0; bit < 20 ; ++bit) {
        if (mask & (1<<bit)) continue;
        next = min(next, edge[pos][bit]);
      }
      pos = next;
      if (pos < N) { mask |= arr[pos]; res.insert(mask); }
    }
  }
  cout << res.size() << endl;
  return 0;
}
